﻿#region Using Statements
using System.Diagnostics;
using System.Windows.Forms;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
#endregion

namespace WinFormsGraphicsDevice
{
    class Triangle
    {
        private int size = 128;
        public bool alive = false;
        private Rectangle pos;
        private bool mouseOver = false;

        public Triangle()
        {
            pos.X = 200;
            pos.Y = 200;
            pos.Width = size;
            pos.Height = size;
        }

        public void Draw(SpriteBatch sb, Texture2D img)
        {
            if (!mouseOver)
                sb.Draw(img, pos, Color.White);
            else
                sb.Draw(img, pos, Color.GreenYellow);
            
        }

        public bool CheckSelect(Point mPos)
        {
            if (pos.Contains(new Point((int)mPos.X, (int)mPos.Y)))
                mouseOver = true;
            else 
                mouseOver = false;

            return mouseOver;
        }

        public void Drag(Point lastmPos, Point mPos)
        {
            pos.X += mPos.X - lastmPos.X;
            pos.Y += mPos.Y - lastmPos.Y;
        }
    }
}
